package com.itheima.qqfarm.servlet.h5;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.itheima.qqfarm.bean.Customer;
import com.itheima.qqfarm.servlet.BaseServlet;
import com.itheima.qqfarm.util.JsonUtils;

public class CustomerH5Servlet extends BaseServlet {

	public void customerLoginTest(HttpServletRequest request, HttpServletResponse response) throws IOException{
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		
		Customer customer = new Customer();
		customer.setUsername(username);
		customer.setPassword(password);
		
		String json = JsonUtils.toJson(customer);
		
		response.setCharacterEncoding("UTF-8");
		response.setContentType("application/json; charset=utf-8");
		PrintWriter printWriter = response.getWriter();
		
		printWriter.write(json);
		printWriter.close();
	}
}
